import java.util.Scanner;

public class Main1395 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int x=0;
        for (int i=1;i<=n;i++){
            int a=i/1000;//1
            int b=i/100%10;
            int c=i%100/10;
            int d=i%10;
            int e=a+b+c+d;
            if (e%2!=0&&e%5!=0){
                x++;
            }
        }
        System.out.println(x);
    }
}
